<template>
    <view class="confirmOrder">
        <SRV-topbar title="商家余额列表" :isLeft="true"></SRV-topbar>
        <view class="row" v-for="(item,index) in list" :key="index">
            <view class="goods_top">
                <view class="left">
                    <image :src="item.cover" mode="aspectFill"></image>
                    <text>{{item.title}}</text>
                </view>
                <view class="left">
                    {{item.name}}-{{item.mobile}}
                </view>
            </view>
            <view class="goods_top">
                <view class="left">商家余额：<text style="color: red;">￥{{item.user_money}}</text></view>
                <view class="left">商家囤陈一：<text style="color: red;">￥{{item.cz_qian_one}}</text></view>
            </view>
            <view class="goods_top" style="border-bottom: unset;">
                <view class="btn" @click="jump('merchantMoneyLog', 'credit_type=user_money&merchant_id='+item.merchant_id)">余额日志</view>
                <view class="btn" @click="jump('merchantMoneyLog', 'credit_type=cz_qian_one&merchant_id='+item.merchant_id)">囤陈一日志</view>
                <view class="btn" v-if="item.rechargeState" @click="jump('merchantOnline', 'merchantKey='+item.merchantKey)">去充值</view>
                <view class="btn" v-if="item.storeState" @click="jump('merchantShopInfo', 'id='+item.merchant_id)">商家商城</view>
            </view>
        </view>
    </view>
</template>

<script>
    var _self;
    import serve from '../static/request.js';
    import storage from '../static/appkey.js';
    import common from '../static/jump.js';
    export default {
        data() {
            return {
                list: []
            }
        },
        methods: {
            getList(){
                serve.request({
                	url: '/member/merchant/money-list',
                	data: {
                        appkey: uni.getStorageSync('appkey'),
                        'access-token': uni.getStorageSync('access-token')
                    },
                    v: '/v3'
                }).then(res => {
                	_self.list = res.data;
                });
            },
			jump(jump_type, jump_link){
				common.jump(jump_type, jump_link);
			}
        },
        onLoad(options) {
            _self = this;
            _self.getList();
        },
        onPullDownRefresh() {
            console.log('refresh');
            _self.getList();
        }
    }
</script>

<style scoped lang="scss">
    @media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
        .confirmOrder {
            padding-bottom: 124rpx !important;

            .bottom {
                padding-bottom: 12px !important;
            }
        }
    }
    .row {
        border: 1rpx solid;
        margin: 10rpx;
        border-radius: 20rpx;
    }
    .goods_top {
        display: flex;
        padding: 10rpx;
        box-sizing: border-box;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1rpx solid #666;
    }
    .left {
        width: 50vw;
    	font-size: 28rpx;
    	display: flex;
    	align-items: center;
    	color: #333333;
    	
    	image {
    		width:40rpx;
    		height:35rpx;
    		margin-right: 13rpx;
    	}
    	
    	text {
    		position: relative;
    		padding-right: 30rpx;
    	}
    }
    .btn {
        border: 1rpx solid #ffd900;
            background: #ffd900;
            padding: 10rpx;
            border-radius: 20rpx;
            margin: 0 10rpx;
    }
</style>
